from flask import Flask
from public.config import Config
from public.db import db
from controller.views.blog_view import blog_bp
from controller.views.user_view import user_bp


def create_app():
    app = Flask(__name__)

    app.config.from_object(Config)

    # 给db对象初始化app
    db.init_app(app)

    # with app.app_context():

    # 注册蓝图
    app.register_blueprint(blog_bp)

    app.register_blueprint(user_bp)

    return app
